package com.usian.feign;

import com.usian.pojo.TbUser;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.Map;

/**
 * @author chen
 * @date 2021/1/21 - 20:08 - 星期四
 * @project usian_parent
 * @package com.usian.feign
 * @by GGbomd猪猪侠
 */
@FeignClient("usian-sso-service")
@Component
public interface SSOServiceFeign {

    /**
     * 对用户的注册信息(用户名与电话号码)做数据校验
     * @param checkValue 用户名 和手机号
     * @param checkFlag
     * @return
     */
    @RequestMapping("/checkUserInfo/{checkValue}/{checkFlag}")
    boolean checkUserInfo(@PathVariable String checkValue, @PathVariable Integer checkFlag);

    /**
     * 用户注册 相当于添加返回一条数据
     * @param tbUser
     * @return
     */
    @RequestMapping("/userRegister")
    Integer userRegister(@RequestBody TbUser tbUser);

    /**
     * u用户登录
     * @param username
     * @param password
     * @return
     */
    @RequestMapping("/userLogin")
    Map userLogin(@RequestParam String username, @RequestParam String password);

    /**
     * 查询用户登录是否已经过期
     * @param token
     * @return
     */
    @RequestMapping("/getUserByToken/{token}")
    TbUser getUserByToken (@PathVariable String token);

    /**
     * 退出登录
     * @param token
     * @return
     */
    @RequestMapping("/logOut")
    Boolean logOut(@RequestParam String token);
}
